package com.by.facade.enums.information.sub;

import com.by.facade.enums.information.PromotionPlatformEventTypeEnum;
import com.by.facade.enums.information.PromotionPlatformTypeEnum;
import lombok.AllArgsConstructor;
import lombok.Getter;

import java.util.Collections;
import java.util.Map;

/**
 * @author Tian Wei
 * @version 1.0
 * @date 2024/3/1 11:43 AM
 */
@Getter
@AllArgsConstructor
public enum BaiDuPromotionPlatformEventEnum{

//    FORM(3,"表单", PromotionPlatformEventTypeEnum.FORM.getType()),
    WX_CP_FRIEND_OPERATION(79,"微信加粉成功", PromotionPlatformEventTypeEnum.WX_CP_FRIEND_OPERATION.getType()),
    ;

    private final Integer eventType;
    private final String desc;

    private final Integer promotionPlatformEventType;

    public static final String OK = "OK";

    public static final String PROMOTION_CHANNEL_NO = "channel";

    public static final String BASE_PUSH_URL = "https://ocpc.baidu.com/ocpcapi/api/uploadConvertData";

    public static BaiDuPromotionPlatformEventEnum resolveByPromotionPlatformEventType(Integer promotionPlatformEventType) {
        return (BaiDuPromotionPlatformEventEnum) PromotionPlatformTypeEnum.PROMOTION_PLATFORM_EVENT_TYPE_MAP.getOrDefault(PromotionPlatformTypeEnum.BAI_DU.getType(), Collections.emptyMap()).get(promotionPlatformEventType);
    }

    public static Boolean checkResult(Map<String,Object> resultMap){
        return resultMap.values().contains(OK);
    }
}
